<?php

namespace app\api\model\mysql;

use app\common\lib\Show;
use app\common\lib\Status;
use app\common\model\TimeModel;
use think\facade\Log;

class MallOrder extends TimeModel
{
    protected $deleteTime = "delete_time";

    /**
     * 获取指定订单信息
     * @param int $order_id
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getByOrderIds(int $order_id=0){
        return $this->field('*')->where("id",$order_id)->find();
    }

    /**
     * @param int $order_id
     * @param string $openid
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getOrderById(array $where=[]){
        return $this->field('*')
            ->where($where)
            ->find();
    }

    /**
     * @param array $where
     * @return int
     */
    public function getOrderByCount(array $where=[]){
        return $this->field('*')->where($where)->count();
    }


}